/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * ProductForm.java
 *
 * Created on Aug 1, 2011, 4:10:08 AM
 */
package INTROSE_MP;

/**
 *
 * @author Paolo
 */
public class ProductForm extends javax.swing.JFrame {
    
    private ManagerWindow mw;
    
    /** Creates new form ProductForm */
    public ProductForm(ManagerWindow mw, String prodName, String size, String price, String stock) {
        initComponents();
        this.mw = mw;
        prodNameTxt.setText(prodName);
        prodSizeTxt.setText(size);
        prodPriceTxt.setText(price);
        prodStockTxt.setText(stock);
        
        
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel2 = new javax.swing.JLabel();
        prodNameTxt = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        prodSizeTxt = new javax.swing.JTextField();
        prodPriceTxt = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        prodStockTxt = new javax.swing.JTextField();
        prodFormError = new javax.swing.JLabel();
        prodSaveButton = new javax.swing.JButton();
        prodFormCancelButton = new javax.swing.JButton();
        jLabel1 = new javax.swing.JLabel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Product Form");
        setResizable(false);
        getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jLabel2.setText("Product Name:");
        getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 16, -1, -1));
        getContentPane().add(prodNameTxt, new org.netbeans.lib.awtextra.AbsoluteConstraints(102, 13, 275, -1));

        jLabel4.setText("Size:");
        getContentPane().add(jLabel4, new org.netbeans.lib.awtextra.AbsoluteConstraints(58, 45, -1, -1));
        getContentPane().add(prodSizeTxt, new org.netbeans.lib.awtextra.AbsoluteConstraints(92, 43, 27, 20));
        getContentPane().add(prodPriceTxt, new org.netbeans.lib.awtextra.AbsoluteConstraints(175, 42, 61, -1));

        jLabel5.setText("Price:");
        getContentPane().add(jLabel5, new org.netbeans.lib.awtextra.AbsoluteConstraints(137, 45, -1, -1));

        jLabel3.setText("Stock:");
        getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(274, 45, -1, -1));
        getContentPane().add(prodStockTxt, new org.netbeans.lib.awtextra.AbsoluteConstraints(315, 42, 62, -1));

        prodFormError.setForeground(new java.awt.Color(255, 0, 0));
        prodFormError.setText("*All fields must have values.");
        prodFormError.setToolTipText("Please ensure that your login details are correct.");
        getContentPane().add(prodFormError, new org.netbeans.lib.awtextra.AbsoluteConstraints(12, 81, -1, -1));

        prodSaveButton.setText("Save");
        prodSaveButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                prodSaveButtonActionPerformed(evt);
            }
        });
        getContentPane().add(prodSaveButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(238, 77, -1, -1));

        prodFormCancelButton.setText("Cancel");
        prodFormCancelButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                prodFormCancelButtonActionPerformed(evt);
            }
        });
        getContentPane().add(prodFormCancelButton, new org.netbeans.lib.awtextra.AbsoluteConstraints(306, 77, -1, -1));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/BG.jpg"))); // NOI18N
        getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(-350, -10, 740, 130));

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void prodFormCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prodFormCancelButtonActionPerformed
        // TODO add your handling code here:
        this.mw.setEnabled(true);
        this.dispose();
    }//GEN-LAST:event_prodFormCancelButtonActionPerformed

    private void prodSaveButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prodSaveButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_prodSaveButtonActionPerformed

    /**
     * @param args the command line arguments
     */
    /**public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                new ProductForm().setVisible(true);
            }
        });
    }**/
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JButton prodFormCancelButton;
    private javax.swing.JLabel prodFormError;
    private javax.swing.JTextField prodNameTxt;
    private javax.swing.JTextField prodPriceTxt;
    private javax.swing.JButton prodSaveButton;
    private javax.swing.JTextField prodSizeTxt;
    private javax.swing.JTextField prodStockTxt;
    // End of variables declaration//GEN-END:variables
}
